﻿using Mes.Domain.BoundedContext.Entities.Operations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Mes.Infrastructure.Data.BoundedContext.EntityTypeConfigurations.Operations
{
    public class StdOperEntRouteEntityConfig : IEntityTypeConfiguration<StdOperEntRoute>
    {
        public void Configure(EntityTypeBuilder<StdOperEntRoute> builder)
        {
            builder.ToTable("stdoper_ent_route");
            builder.Property(b => b.Process_Route_Id).IsRequired();
            builder.HasKey(b => new { b.Process_Route_Id, b.Oper_Id, b.Ent_Id, b.Input_Oper_Id, b.Input_Ent_Id });
            builder.Property(b => b.Oper_Id).HasMaxLength(40).IsRequired();
            builder.Property(b => b.Ent_Id).IsRequired();
            builder.Property(b => b.Input_Oper_Id).HasMaxLength(40).IsRequired();
            builder.Property(b => b.Input_Ent_Id).IsRequired();
            builder.Property(b => b.Input_Percent).IsRequired();
            builder.Property(b => b.Last_Edit_Comment).HasMaxLength(254).IsRequired();
            builder.Property(b => b.Last_Edit_By).HasMaxLength(40).IsRequired();
            builder.Property(b => b.Last_Edit_At).IsRequired();
            builder.Property(b => b.Mod_Id).IsRequired();
            builder.Property(b => b.Row_Id).IsRequired().UseIdentityColumn().HasIdentityOptions(startValue: 0, incrementBy: 1, minValue: 0);
            builder.Property(b => b.Order).IsRequired();
        }
    }
}
